package cn.dceast.former.service;

import cn.dceast.former.dao.EyeModelCommentMapper;
import cn.dceast.former.model.EyeModelComment;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.HashMap;
import java.util.List;
import java.util.Map;

/**
 * Created by fanbo on 2017-07-18.
 * 模型评价服务
 */
@Service
public class EyeModelCommentService {

    @Autowired
    private EyeModelCommentMapper eyeModelCommentMapper;

    /**
     * 添加用户评论
     * @param eyeModelEvaluate
     * @return
     */
    public int AddModelEvaluate(Map eyeModelEvaluate) {
        return eyeModelCommentMapper.addComment(eyeModelEvaluate);
    }

    /**
     * 根据用户及模型查询用户评论
     * @param eyeModelEvaluate
     * @return
     */
    public List<EyeModelComment> selectModelEvaluate(EyeModelComment eyeModelEvaluate) {
        return eyeModelCommentMapper.select(eyeModelEvaluate);
    }


    public List<Map<String,Object>> selectModelEvaluateById(String userID, Integer modelID) {
        Map<String,Object> param = new HashMap<>();
        param.put("userID",userID);
        param.put("modelID",modelID);
        return eyeModelCommentMapper.selectModelEvaluateById(param);
    }
}
